package com.appjishu.web.util.pubsub;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Async;

import com.appjishu.web.util.pubsub.model.MqMessage;

/**
 * @author edmond
 * @date 2020/03/25
 */
public abstract class EventProvider {

	@Autowired
	private RedisTemplate<String, MqMessage> redisEvent;
	
	@Async
	public void sendMessage(Object model) {
	    redisEvent.convertAndSend(PubSubConfig.pubsubPrefix + topic(), model);
	}

	public abstract String topic();
}
